// pages/resetPwd/resetPwd.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    new_password:''
  },

  newPwd(e){
    console.log(e)
    this.setData({
      new_password:e.detail.value
    })
  },

  submit(){
    let new_password = this.data.new_password
    let access_token = wx.getStorageSync('access_token')
    wx.request({
      url: 'https://retire.wshoto.com/wx/resetpwd',
      data: {
        access_token: access_token,
        new_password:new_password
      },
      success: (res) => {
        console.log(res)
        if(res.data.code == 1){
          wx.showModal({
            title:'提示',
            content:res.data.msg,
            showCancel:false,
            success:(res)=>{
              console.log(res)
              if(res.confirm){
                wx.navigateBack()
              }
            }
          })
        } else {
          wx.showModal({
            title:'提示',
            content:res.data.msg,
            showCancel:false,
            success:(res)=>{
              console.log(res)
            }
          })
        }
      }
    })  
  }
})